import math

def find_min_speed(h, miles):
    left, right = 1, max(miles)
    while left < right:
        mid = (left + right) // 2
        total_time = sum(math.ceil(distance / mid) for distance in miles)
        if total_time <= h:
            right = mid
        else:
            left = mid + 1
    
    return left
h = 5
miles = [30, 11, 23, 4, 20]
v = find_min_speed(h, miles)
print(v) 